/*
 * Copyright (c) 2022-2022 All rights Reserved.
 */

package com.driving.core.controller.html;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.driving.core.service.IStudentService;
import com.driving.core.service.dto.ApplyDTO;
import com.driving.core.util.Response;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 前端控制器
 *
 * @author SAGITTAR
 * @since 2017
 */
@Slf4j
@Controller
@RequestMapping(value = { "/", "/html" })
@RequiredArgsConstructor
public class HtmlController {

    private final IStudentService studentService;

    @RequestMapping(value = { "/", "/index" })
    public String index() {
        return "index";
    }

    @RequestMapping(value = "/introduce")
    public String introduce() {
        return "introduce";
    }

    @RequestMapping(value = "/enroll")
    public String enroll() {
        return "enroll";
    }

    @ResponseBody
    @RequestMapping(value = "/htmlApply")
    public Response<Object> htmlApply(@RequestBody ApplyDTO applyDTO) {
        return Response.success(studentService.apply(applyDTO));
    }
}
